Skip to content

Conversation

@birschick-bq
Copy link
Contributor

Adds more telemetry information for Apache drivers

  • increase connection information.
  • add activities for more methods to track durations.
  • now using explicit activity names to improve context
  • using Activity.AddTag instead of Activity.SetTag as SetTag is more expensive.

@github-actions github-actions bot added this to the ADBC Libraries 22 milestone Dec 12, 2025
@birschick-bq
Copy link
Contributor Author

@CurtHagenlocher - When you have some time, can you review this small PR to instrument more tracing in the other Thrift-based driver? Thanks.

Copy link
Contributor

@CurtHagenlocher CurtHagenlocher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Today, we have a bunch of helpers that work with object-typed tag values, and many of the existing calls pass types other than strings. But in this change, almost everything is converted to a string first. I think we need to decide whether tag values should always be strings or whether they can be other object values as well and be consistent about the path we take.

httpClient.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("identity"));
httpClient.DefaultRequestHeaders.ExpectContinue = false;

activity?.AddTag(ActivityKeys.Encrypted, TlsOptions.IsTlsEnabled.ToString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use object-valued tags in a lot of other places; why do the ToString() here?

Same comment applies to AddTag calls throughout this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CurtHagenlocher

This has to do with a previous failed attempt to use JsonSerializerContext for the SerialializableActivity class.

When using JsonSerializerContext, it would throw and exception if it didn't know how to serialize a particular object that was added to a Tag (e.g., collection, etc.). This issue could be fixed by adding that class to the definition, but that would mean any instrumenters of tracing would have to remember to decorate this class.

So, I ended up removing it.

My intention is to simplify the AddTag so that only types that could be handled by JsonSerializerContext natively should be added.

I think I went overboard, as I believe numeric and boolean types should serialize fine.

At any rate, if we do restrict the types passed to AddTag, we can do that in one change rather than a trickle.

I'll remove the ToString() usage except for enums, where the name is better than than the number.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CurtHagenlocher

I've remove unnecessary ToString() calls for boolean and URI. I've left them in for enum types, as it is easier to read.

@CurtHagenlocher CurtHagenlocher merged commit 778f780 into apache:main Jan 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants